def isAnagram(str1, str2):
    judge = False
    list1 = list(str1)
    list2 = list(str2)
    if len(list1) == len(list2):
        list1.sort()
        list2.sort()
        if list1 == list2:
            judge = True
    return judge

# === DO NOT modify the code below ===
def main():
    s1 = input()
    s2 = input()
    print(1 if isAnagram(s1, s2) else 0)
    
if __name__ == '__main__':
    main()
# === DO NOT modify the code above ===